package csel.model;

public class Potion extends UseableItem implements java.io.Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public Potion()
	{
		setTypeId("potion");
	}

	public boolean use(Entity e)
	{
		e.getInventory().dropUseableItem(this);
		int damage = e.getLifeLeft();
		if (damage <= 5)
		{
			e.setLifeLeft(0);
		} else
		{
			e.setLifeLeft(damage - 5);
		}
		return true;
	}

	public boolean touch(Entity e)
	{
		this.getLocation().setItem(null);
		return e.getInventory().addUseableItem(this);
	}
}
